package view.listener;

import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

import controller.UseCaseController;
import controller.data.readDocumentation.ReadDocumentationRequest;

import singleton.Singleton;
import view.views.CSADView;

public class ButtonListener implements Listener {

	CSADView view;
	UseCaseController controller;

	public ButtonListener(CSADView view) {
		this.view = view;
		this.controller = Singleton.getInstance().getUseCaseController();
	}

	public void handleEvent(Event event) {
		Button button = (Button) event.widget;
		if (button.getText().compareTo("Previous page") == 0) {
			// Previous page
			view.listOfData = controller.previousDocumentationPage();
		}else{// "Next Page"
			view.listOfData = controller.nextDocumentationPage();
		}
		view.createTabView();
	}
}
